
import purchaseApi from "@/api/declaration/erp/purchaseApi"
import httpRequest from "@/config/axios/httpRequest"
import { PurchaseInModel } from "@/models/erp/PurchaseInModel"




// ERP 采购入库 API
export const PurchaseInApi = {
  // 查询采购入库分页
  getPurchaseInPage: async (params: any) => {
    return await httpRequest.get(purchaseApi.GetPurchaseInPage, params)
  },

  // 查询采购入库详情
  getPurchaseIn: async (id: number) => {
    return await httpRequest.get(purchaseApi.GetPurchaseIn, { params: { id} })
  },

  // 新增采购入库
  createPurchaseIn: async (data: PurchaseInModel) => {
    return await httpRequest.post(purchaseApi.CreatePurchaseIn, data)
  },

  // 修改采购入库
  updatePurchaseIn: async (data: PurchaseInModel) => {
    return await httpRequest.put(purchaseApi.UpdatePurchaseIn, data)
  },

  // 更新采购入库的状态
  updatePurchaseInStatus: async (id: number, status: number) => {
    return await httpRequest.put(purchaseApi.UpdatePurchaseInStatus, { id, status })
  },

  // 删除采购入库
  deletePurchaseIn: async (ids: number[]) => {
    return await httpRequest.delete(purchaseApi.DeletePurchaseIn, { params: { ids } })
  },

  // 导出采购入库 Excel
  exportPurchaseIn: async (params: any) => {
    return await httpRequest.download(purchaseApi.ExportPurchaseIn, params)
  }
}
